﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace Model
{
    [Serializable]
    public partial class Pot4a00
    {
		private string _promocode;
		private string _pid;
        private DateTime? _startdate;
        private DateTime? _endate;
		private double _oprice;
		private double _nprice;
		private string _muser;
		private string _listid;
		
        /// <summary>
        /// 促销代码
        /// </summary>
		public string Promocode
		{
			get { return _promocode;	 }
			set { _promocode=value;	}
		}
        /// <summary>
        /// 商品标识
        /// </summary>
		public string Pid
		{
			get { return _pid;	 }
			set { _pid=value;	}
		}
        /// <summary>
        /// 促销开始日
        /// </summary>
		public DateTime? Startdate
		{
			get { return _startdate;	 }
			set { _startdate=value;	}
		}
        /// <summary>
        /// 促销截止日
        /// </summary>
		public DateTime? Endate
		{
			get { return _endate;	 }
			set { _endate=value;	}
		}
        /// <summary>
        /// 原出货价
        /// </summary>
		public double Oprice
		{
			get { return _oprice;	 }
			set { _oprice=value;	}
		}
        /// <summary>
        /// 现出货价
        /// </summary>
		public double Nprice
		{
			get { return _nprice;	 }
			set { _nprice=value;	}
		}
        /// <summary>
        /// 用户标识
        /// </summary>
		public string Muser
		{
			get { return _muser;	 }
			set { _muser=value;	}
		}
        /// <summary>
        /// 主键标识
        /// </summary>
		public string Listid
		{
			get { return _listid;	 }
			set { _listid=value;	}
		}
		
		public static List<Pot4a00> GetPot4a00ListByDataTable(DataTable dt)
		{
			if(dt == null) return null;
		    List<Pot4a00> list = new List<Pot4a00>();
		   
			foreach(DataRow dr in dt.Rows)
            {
				Pot4a00 model = GetPot4a00ByDataRow(dr);
				if(null == model) continue;
				
				list.Add(model);
            }
           return list;
		}
		
		public static Pot4a00 GetPot4a00ByDataRow(DataRow dr)
		{
			Pot4a00 model = new Pot4a00(); //实例化Pot4a00
	
			DataColumnCollection dcc = dr.Table.Columns;

			if (dcc.Contains("promocode")&&!(dr["promocode"] is System.DBNull))  
				model.Promocode = ( string)dr["promocode"];
			if (dcc.Contains("pid")&&!(dr["pid"] is System.DBNull))  
				model.Pid = ( string)dr["pid"];
			if (dcc.Contains("startdate")&&!(dr["startdate"] is System.DBNull))  
				model.Startdate = ( DateTime)dr["startdate"];
			if (dcc.Contains("endate")&&!(dr["endate"] is System.DBNull))  
				model.Endate = ( DateTime)dr["endate"];
			if (dcc.Contains("oprice")&&!(dr["oprice"] is System.DBNull))  
				model.Oprice = Convert.ToDouble(dr["oprice"]);
			if (dcc.Contains("nprice")&&!(dr["nprice"] is System.DBNull))  
				model.Nprice = Convert.ToDouble(dr["nprice"]);
			if (dcc.Contains("muser")&&!(dr["muser"] is System.DBNull))  
				model.Muser = ( string)dr["muser"];
			if (dcc.Contains("listid")&&!(dr["listid"] is System.DBNull))  
				model.Listid = ( string)dr["listid"];
			
			return model;
		}
    }
}
